﻿using System;
using DataScripter.Scripting.Output.Sql.SqlServer;

namespace DataScripter.Scripting.Output
{
    public static class ScriptResultFactory
    {
        public static IScriptResult CreateScriptResult(ScriptOptions options)
        {
            if (options is SqlServerScriptOptions)
            {
                if (options.ScriptOutputType == ScriptOutputType.File)
                {
                    FileScriptResult fileScriptResult = new FileScriptResult(options.Filename, options.Append, options.Encoding);
                    return fileScriptResult;
                }
                if (options.ScriptOutputType == ScriptOutputType.Memory)
                {
                    MemoryScriptResult memoryScriptResult = new MemoryScriptResult();
                    return memoryScriptResult;
                }
            }

            throw new NotImplementedException("The options you requested are not implemented yet.");
        }
    }
}